diff options
31 files changed, 85 insertions, 62 deletions
diff --git a/config-model-api/src/main/java/com/yahoo/config/application/api/ApplicationMetaData.java b/config-model-api/src/main/java/com/yahoo/config/application/api/ApplicationMetaData.java index a3769299cf8..236a954f483 100644 --- a/config-model-api/src/main/java/com/yahoo/config/application/api/ApplicationMetaData.java +++ b/config-model-api/src/main/java/com/yahoo/config/application/api/ApplicationMetaData.java @@ -171,4 +171,5 @@ public class ApplicationMetaData { throw new RuntimeException("Unable to encode metadata", e); } } + } diff --git a/config-provisioning/src/main/java/com/yahoo/config/provision/Deployer.java b/config-provisioning/src/main/java/com/yahoo/config/provision/Deployer.java index 111073aca77..2254b6d7747 100644 --- a/config-provisioning/src/main/java/com/yahoo/config/provision/Deployer.java +++ b/config-provisioning/src/main/java/com/yahoo/config/provision/Deployer.java @@ -11,14 +11,13 @@ import java.util.Optional; */ public interface Deployer { - /** * Creates a new deployment from the active application, if available. Will use the default timeout for deployment. * * @param application the active application to be redeployed * @return a new deployment from the local active, or empty if a local active application - * was not present for this id (meaning it either is not active or active on another - * node in the config server cluster) + * was not present for this id (meaning it either is not active or deployed at another + * node in the config server cluster) */ Optional<Deployment> deployFromLocalActive(ApplicationId application); diff --git a/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/ClientUpdater.java b/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/ClientUpdater.java index 0ed5d04e36e..8b8f75a3f99 100644 --- a/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/ClientUpdater.java +++ b/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/ClientUpdater.java @@ -15,6 +15,7 @@ import java.util.logging.Logger; * @author hmusum */ class ClientUpdater { + private final static Logger log = Logger.getLogger(ClientUpdater.class.getName()); private final ConfigProxyStatistics statistics; diff --git a/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/ConfigSourceClient.java b/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/ConfigSourceClient.java index f636e723828..5bab27c27a5 100644 --- a/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/ConfigSourceClient.java +++ b/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/ConfigSourceClient.java @@ -11,7 +11,6 @@ import java.util.List; * getting config. * * @author hmusum - * @since 5.1.9 */ interface ConfigSourceClient { @@ -24,4 +23,5 @@ interface ConfigSourceClient { String getActiveSourceConnection(); List<String> getSourceConnections(); + } diff --git a/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/DelayedResponse.java b/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/DelayedResponse.java index 76c5cb424e8..047576ee647 100644 --- a/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/DelayedResponse.java +++ b/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/DelayedResponse.java @@ -15,6 +15,7 @@ import java.util.concurrent.TimeUnit; * @see DelayedResponseHandler */ public class DelayedResponse implements Delayed { + private final JRTServerConfigRequest request; private final long returnTime; @@ -58,8 +59,7 @@ public class DelayedResponse implements Delayed { @Override public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append(request.getShortDescription()).append(", delayLeft=").append(getDelay(TimeUnit.MILLISECONDS)).append(" ms"); - return sb.toString(); + return request.getShortDescription() + ", delayLeft=" + getDelay(TimeUnit.MILLISECONDS) + " ms"; } + } diff --git a/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/DelayedResponses.java b/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/DelayedResponses.java index 00f948ef690..953aeefbfd1 100644 --- a/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/DelayedResponses.java +++ b/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/DelayedResponses.java @@ -7,7 +7,6 @@ import java.util.concurrent.DelayQueue; * Queue for requests that have no corresponding config in cache and which we are awaiting response from server for * * @author hmusum - * @since 5.1.7 */ class DelayedResponses { diff --git a/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/MemoryCache.java b/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/MemoryCache.java index 7914b7a80b6..0fe7fe01467 100644 --- a/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/MemoryCache.java +++ b/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/MemoryCache.java @@ -21,6 +21,7 @@ import java.util.logging.Logger; * @author hmusum */ public class MemoryCache { + private static final Logger log = Logger.getLogger(MemoryCache.class.getName()); // Separator in file names between different fields of config key @@ -35,6 +36,7 @@ public class MemoryCache { /** * Put in cache, except when config has an error + * * @param config config to put in cache */ public void put(RawConfig config) { diff --git a/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/ProxyServer.java b/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/ProxyServer.java index 28bcca9db13..6390c9ca165 100644 --- a/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/ProxyServer.java +++ b/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/ProxyServer.java @@ -132,7 +132,7 @@ public class ProxyServer implements Runnable { } static boolean configOrGenerationHasChanged(RawConfig config, JRTServerConfigRequest request) { - return (config != null && (!config.hasEqualConfig(request) || config.hasNewerGeneration(request))); + return (config != null && ( ! config.hasEqualConfig(request) || config.hasNewerGeneration(request))); } Mode getMode() { diff --git a/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/RpcConfigSourceClient.java b/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/RpcConfigSourceClient.java index 0f80f228b36..b4eda05fde4 100644 --- a/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/RpcConfigSourceClient.java +++ b/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/RpcConfigSourceClient.java @@ -148,7 +148,8 @@ class RpcConfigSourceClient implements ConfigSourceClient { log.log(LogLevel.DEBUG, () -> "Already a subscriber running for: " + configCacheKey); } else { log.log(LogLevel.DEBUG, () -> "Could not find good config in cache, creating subscriber for: " + configCacheKey); - UpstreamConfigSubscriber subscriber = new UpstreamConfigSubscriber(input, clientUpdater, configSourceSet, timingValues, requesterPool, memoryCache); + UpstreamConfigSubscriber subscriber = new UpstreamConfigSubscriber(input, clientUpdater, configSourceSet, + timingValues, requesterPool, memoryCache); try { subscriber.subscribe(); activeSubscribers.put(configCacheKey, subscriber); diff --git a/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/Subscriber.java b/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/Subscriber.java index 32b1c661a75..74c99b7670b 100644 --- a/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/Subscriber.java +++ b/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/Subscriber.java @@ -5,7 +5,6 @@ package com.yahoo.vespa.config.proxy; * Interface for subscribing to config from upstream config sources. * * @author hmusum - * @since 5.5 */ public interface Subscriber extends Runnable { diff --git a/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/UpstreamConfigSubscriber.java b/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/UpstreamConfigSubscriber.java index 528c61fe132..ceaf57e9cf1 100644 --- a/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/UpstreamConfigSubscriber.java +++ b/config-proxy/src/main/java/com/yahoo/vespa/config/proxy/UpstreamConfigSubscriber.java @@ -17,9 +17,9 @@ import java.util.logging.Logger; /** * @author hmusum - * @since 5.5 */ public class UpstreamConfigSubscriber implements Subscriber { + private final static Logger log = Logger.getLogger(UpstreamConfigSubscriber.class.getName()); private final RawConfig config; @@ -33,8 +33,7 @@ public class UpstreamConfigSubscriber implements Subscriber { UpstreamConfigSubscriber(RawConfig config, ClientUpdater clientUpdater, ConfigSource configSourceSet, TimingValues timingValues, Map<ConfigSourceSet, JRTConfigRequester> requesterPool, - MemoryCache memoryCache) - { + MemoryCache memoryCache) { this.config = config; this.clientUpdater = clientUpdater; this.configSourceSet = configSourceSet; @@ -46,7 +45,7 @@ public class UpstreamConfigSubscriber implements Subscriber { void subscribe() { subscriber = new GenericConfigSubscriber(requesterPool); ConfigKey<?> key = config.getKey(); - handle = subscriber.subscribe(new ConfigKey<RawConfig>(key.getName(), key.getConfigId(), key.getNamespace()), + handle = subscriber.subscribe(new ConfigKey<>(key.getName(), key.getConfigId(), key.getNamespace()), config.getDefContent(), configSourceSet, timingValues); } @@ -66,7 +65,7 @@ public class UpstreamConfigSubscriber implements Subscriber { } private void updateWithNewConfig(GenericConfigHandle handle) { - final RawConfig newConfig = handle.getRawConfig(); + RawConfig newConfig = handle.getRawConfig(); if (log.isLoggable(LogLevel.DEBUG)) { log.log(LogLevel.DEBUG, "config to be returned for '" + newConfig.getKey() + "', generation=" + newConfig.getGeneration() + @@ -82,4 +81,5 @@ public class UpstreamConfigSubscriber implements Subscriber { subscriber.close(); } } + } diff --git a/config/src/main/java/com/yahoo/config/subscription/impl/ConfigSubscription.java b/config/src/main/java/com/yahoo/config/subscription/impl/ConfigSubscription.java index 9f277330401..64eee39af1f 100644 --- a/config/src/main/java/com/yahoo/config/subscription/impl/ConfigSubscription.java +++ b/config/src/main/java/com/yahoo/config/subscription/impl/ConfigSubscription.java @@ -324,6 +324,7 @@ public abstract class ConfigSubscription<T extends ConfigInstance> { * True if someone has set the {@link #reloadedGeneration} number by calling {@link #reload(long)} * and hence wants to force a given generation programmatically. If that is the case, * sets the generation and flags it as changed accordingly. + * * @return true if {@link #reload(long)} has been called, false otherwise */ protected boolean checkReloaded() { diff --git a/config/src/main/java/com/yahoo/config/subscription/impl/GenericConfigHandle.java b/config/src/main/java/com/yahoo/config/subscription/impl/GenericConfigHandle.java index 916aa6faeff..bf247dffb7c 100644 --- a/config/src/main/java/com/yahoo/config/subscription/impl/GenericConfigHandle.java +++ b/config/src/main/java/com/yahoo/config/subscription/impl/GenericConfigHandle.java @@ -12,14 +12,15 @@ import com.yahoo.vespa.config.RawConfig; @SuppressWarnings({"rawtypes", "unchecked"}) public class GenericConfigHandle extends ConfigHandle { - private final GenericJRTConfigSubscription genSub; + private final GenericJRTConfigSubscription subscription; - public GenericConfigHandle(GenericJRTConfigSubscription sub) { - super(sub); - genSub = sub; + public GenericConfigHandle(GenericJRTConfigSubscription subscription) { + super(subscription); + this.subscription = subscription; } public RawConfig getRawConfig() { - return genSub.getRawConfig(); + return subscription.getRawConfig(); } + } diff --git a/config/src/main/java/com/yahoo/config/subscription/impl/GenericConfigSubscriber.java b/config/src/main/java/com/yahoo/config/subscription/impl/GenericConfigSubscriber.java index a33c1556dd3..82d4708f53b 100644 --- a/config/src/main/java/com/yahoo/config/subscription/impl/GenericConfigSubscriber.java +++ b/config/src/main/java/com/yahoo/config/subscription/impl/GenericConfigSubscriber.java @@ -19,6 +19,7 @@ import com.yahoo.vespa.config.TimingValues; * @author vegardh */ public class GenericConfigSubscriber extends ConfigSubscriber { + /** * Constructs a new subscriber using the given pool of requesters (JRTConfigRequester holds 1 connection which in * turn is subject to failover across the elems in the source set.) @@ -72,4 +73,5 @@ public class GenericConfigSubscriber extends ConfigSubscriber { */ public void closeRequesters() { } + } diff --git a/config/src/main/java/com/yahoo/config/subscription/impl/JRTConfigSubscription.java b/config/src/main/java/com/yahoo/config/subscription/impl/JRTConfigSubscription.java index 920c8c264e7..58f720b8cb6 100644 --- a/config/src/main/java/com/yahoo/config/subscription/impl/JRTConfigSubscription.java +++ b/config/src/main/java/com/yahoo/config/subscription/impl/JRTConfigSubscription.java @@ -172,6 +172,7 @@ public class JRTConfigSubscription<T extends ConfigInstance> extends ConfigSubsc /** * The timing values of this + * * @return timing values */ public TimingValues timingValues() { diff --git a/config/src/main/java/com/yahoo/vespa/config/ConfigCacheKey.java b/config/src/main/java/com/yahoo/vespa/config/ConfigCacheKey.java index 79edeea99fc..e8e3fe9ed94 100644 --- a/config/src/main/java/com/yahoo/vespa/config/ConfigCacheKey.java +++ b/config/src/main/java/com/yahoo/vespa/config/ConfigCacheKey.java @@ -3,10 +3,11 @@ package com.yahoo.vespa.config; /** * A ConfigKey that also uses the def MD5 sum. Used for caching when def payload is user provided. - * @author vegardh * + * @author Vegard Havdal */ public class ConfigCacheKey { + private final ConfigKey<?> key; private final String defMd5; @@ -45,6 +46,7 @@ public class ConfigCacheKey { /** * The def md5 sum of this key + * * @return md5 sum */ public String getDefMd5() { diff --git a/config/src/main/java/com/yahoo/vespa/config/ConfigKey.java b/config/src/main/java/com/yahoo/vespa/config/ConfigKey.java index 5f068c4708a..930b74ea804 100755 --- a/config/src/main/java/com/yahoo/vespa/config/ConfigKey.java +++ b/config/src/main/java/com/yahoo/vespa/config/ConfigKey.java @@ -135,4 +135,5 @@ public class ConfigKey<CONFIGCLASS extends ConfigInstance> implements Comparable public static ConfigKey<?> createFull(String name, String configId, String namespace, String md5) { return new ConfigKey<>(name, configId, namespace, md5, null); } + } diff --git a/config/src/main/java/com/yahoo/vespa/config/GetConfigRequest.java b/config/src/main/java/com/yahoo/vespa/config/GetConfigRequest.java index 8021fa95514..c5eeab74157 100644 --- a/config/src/main/java/com/yahoo/vespa/config/GetConfigRequest.java +++ b/config/src/main/java/com/yahoo/vespa/config/GetConfigRequest.java @@ -7,10 +7,8 @@ import java.util.Optional; /** * Interface for getConfig requests. - * @author lulf - * @since 5.3 + * @author Ulf Lilleengen */ - public interface GetConfigRequest { /** @@ -22,6 +20,7 @@ public interface GetConfigRequest { /** * The def file contents in the request, or empty array if not sent/not supported + * * @return the contents (payload) of the def schema */ DefContent getDefContent(); @@ -33,7 +32,9 @@ public interface GetConfigRequest { /** * Whether or not the config can be retrieved from or stored in a cache. + * * @return true if content should _not_ be cached, false if it should. */ boolean noCache(); + } diff --git a/config/src/main/java/com/yahoo/vespa/config/RawConfig.java b/config/src/main/java/com/yahoo/vespa/config/RawConfig.java index ae4431e5195..329264e0042 100755 --- a/config/src/main/java/com/yahoo/vespa/config/RawConfig.java +++ b/config/src/main/java/com/yahoo/vespa/config/RawConfig.java @@ -35,6 +35,7 @@ public class RawConfig extends ConfigInstance { /** * Constructor for an empty config (not yet resolved). + * * @param key The ConfigKey * @param defMd5 The md5 sum of the .def-file. */ @@ -69,6 +70,7 @@ public class RawConfig extends ConfigInstance { /** * Creates a new Config from the given request, with the values in the response parameters. + * * @param req a {@link JRTClientConfigRequest} */ public static RawConfig createFromResponseParameters(JRTClientConfigRequest req) { @@ -85,6 +87,7 @@ public class RawConfig extends ConfigInstance { /** * Creates a new Config from the given request, with the values in the response parameters. + * * @param req a {@link JRTClientConfigRequest} */ public static RawConfig createFromServerRequest(JRTServerConfigRequest req) { @@ -133,7 +136,7 @@ public class RawConfig extends ConfigInstance { /** * Returns true if this config is equal to the config (same payload md5) in the given request. * - * @param req The request for which to compare config payload with this config. + * @param req the request for which to compare config payload with this config. * @return true if this config is equal to the config in the given request. */ public boolean hasEqualConfig(JRTServerConfigRequest req) { @@ -143,7 +146,7 @@ public class RawConfig extends ConfigInstance { /** * Returns true if this config has a more recent generation than the config in the given request. * - * @param req The request for which to compare generation with this config. + * @param req the request for which to compare generation with this config. * @return true if this config has a more recent generation than the config in the given request. */ public boolean hasNewerGeneration(JRTServerConfigRequest req) { @@ -158,6 +161,7 @@ public class RawConfig extends ConfigInstance { return (errorCode() != 0); } + @Override public boolean equals(Object o) { if (o == this) { return true; @@ -184,6 +188,7 @@ public class RawConfig extends ConfigInstance { } } + @Override public int hashCode() { int hash = 17; if (key != null) { @@ -203,6 +208,7 @@ public class RawConfig extends ConfigInstance { return hash; } + @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(key.getNamespace()).append(".").append(key.getName()); @@ -222,4 +228,5 @@ public class RawConfig extends ConfigInstance { public List<String> getDefContent() { return defContent; } + } diff --git a/config/src/main/java/com/yahoo/vespa/config/protocol/JRTConfigRequest.java b/config/src/main/java/com/yahoo/vespa/config/protocol/JRTConfigRequest.java index 46b3651afd7..26fa41c19c7 100644 --- a/config/src/main/java/com/yahoo/vespa/config/protocol/JRTConfigRequest.java +++ b/config/src/main/java/com/yahoo/vespa/config/protocol/JRTConfigRequest.java @@ -8,11 +8,14 @@ import java.util.Optional; /** * Common interface for jrt config requests available both at server and client. + * * @author Ulf Lilleengen */ public interface JRTConfigRequest { + /** * Get the config key of the config request. + * * @return a {@link ConfigKey}. */ ConfigKey<?> getConfigKey(); @@ -20,18 +23,21 @@ public interface JRTConfigRequest { /** * Perform request parameter validation of this config request. This method should be called before fetching * any kind of config protocol-specific parameter. + * * @return true if valid, false if not. */ boolean validateParameters(); /** * Get the config md5 of the config request. Return an empty string if no response has been returned. + * * @return a config md5. */ String getRequestConfigMd5(); /** * Get the generation of the requested config. If none has been given, 0 should be returned. + * * @return the generation in the request. */ long getRequestGeneration(); @@ -39,42 +45,49 @@ public interface JRTConfigRequest { /** * Get the JRT request object for this config request. * TODO: This method leaks the internal jrt stuff :( + * * @return a {@link Request} object. */ Request getRequest(); /** * Get a short hand description of this request. + * * @return a short description */ String getShortDescription(); /** * Get the error code of this request + * * @return the error code as defined in {@link com.yahoo.vespa.config.ErrorCode}. */ int errorCode(); /** * Return the error message of this request, mostly corresponding to the {@link com.yahoo.vespa.config.ErrorCode}. + * * @return the error message. */ String errorMessage(); /** * Get the server timeout of this request. + * * @return the timeout given to the server */ long getTimeout(); /** * Get the config protocol version + * * @return a protocol version number. */ long getProtocolVersion(); /** * Get the wanted generation for this request. + * * @return a generation that client would like. */ long getWantedGeneration(); @@ -87,7 +100,9 @@ public interface JRTConfigRequest { /** * Get the Vespa version of the client that initiated the request + * * @return Vespa version of the client */ Optional<VespaVersion> getVespaVersion(); + } diff --git a/config/src/main/java/com/yahoo/vespa/config/protocol/SlimeRequestData.java b/config/src/main/java/com/yahoo/vespa/config/protocol/SlimeRequestData.java index 65e50acb72d..5e88c4cb146 100644 --- a/config/src/main/java/com/yahoo/vespa/config/protocol/SlimeRequestData.java +++ b/config/src/main/java/com/yahoo/vespa/config/protocol/SlimeRequestData.java @@ -12,11 +12,10 @@ import com.yahoo.vespa.config.ConfigKey; import java.util.Optional; /** - * Contains slime request data objects. Provides methods for reading various fields from slime request data. All - * data is read lazily. + * Contains slime request data objects. Provides methods for reading various fields from slime request data. + * All data is read lazily. * -* @author lulf -* @since 5.18 +* @author Ulf Lilleengen */ class SlimeRequestData { diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/ConfigServerDB.java b/configserver/src/main/java/com/yahoo/vespa/config/server/ConfigServerDB.java index 72a470cf937..152fc47d807 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/ConfigServerDB.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/ConfigServerDB.java @@ -20,6 +20,7 @@ import java.util.List; * @author Ulf Lilleengen */ public class ConfigServerDB { + private static final java.util.logging.Logger log = java.util.logging.Logger.getLogger(ConfigServerDB.class.getName()); private final File serverDB; private final ConfigserverConfig configserverConfig; diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/SuperModelRequestHandler.java b/configserver/src/main/java/com/yahoo/vespa/config/server/SuperModelRequestHandler.java index 9999fb31e77..d5f3a237b9d 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/SuperModelRequestHandler.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/SuperModelRequestHandler.java @@ -23,8 +23,7 @@ import java.util.Set; /** * Handles request for supermodel config. * - * @author lulf - * @since 5.9 + * @author Ulf Lilleengen */ public class SuperModelRequestHandler implements RequestHandler { diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/http/HttpConfigResponse.java b/configserver/src/main/java/com/yahoo/vespa/config/server/http/HttpConfigResponse.java index 489424f8791..43fc0a2f418 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/http/HttpConfigResponse.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/http/HttpConfigResponse.java @@ -14,9 +14,9 @@ import static com.yahoo.jdisc.http.HttpResponse.Status.OK; * HTTP getConfig response * * @author lulf - * @since 5.1 */ public class HttpConfigResponse extends HttpResponse { + public static final String JSON_CONTENT_TYPE = "application/json"; private final ConfigResponse config; diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/rpc/GetConfigProcessor.java b/configserver/src/main/java/com/yahoo/vespa/config/server/rpc/GetConfigProcessor.java index 970fe9f169b..55d5321c93f 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/rpc/GetConfigProcessor.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/rpc/GetConfigProcessor.java @@ -42,7 +42,7 @@ class GetConfigProcessor implements Runnable { } private void respond(JRTServerConfigRequest request) { - final Request req = request.getRequest(); + Request req = request.getRequest(); if (req.isError()) { Level logLevel = (req.errorCode() == ErrorCode.APPLICATION_NOT_LOADED) ? LogLevel.DEBUG : LogLevel.INFO; log.log(logLevel, logPre + req.errorMessage()); diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionFactoryImpl.java b/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionFactoryImpl.java index 10590a26690..6e34511c62d 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionFactoryImpl.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionFactoryImpl.java @@ -92,14 +92,14 @@ public class SessionFactoryImpl implements SessionFactory, LocalSessionLoader { File configApplicationDir, String applicationName, long sessionId, - long currentlyActiveSession, + long currentlyActiveSessionId, boolean internalRedeploy) { long deployTimestamp = System.currentTimeMillis(); String user = System.getenv("USER"); if (user == null) { user = "unknown"; } - DeployData deployData = new DeployData(user, userDir.getAbsolutePath(), applicationName, deployTimestamp, internalRedeploy, sessionId, currentlyActiveSession); + DeployData deployData = new DeployData(user, userDir.getAbsolutePath(), applicationName, deployTimestamp, internalRedeploy, sessionId, currentlyActiveSessionId); return FilesApplicationPackage.fromFileWithDeployData(configApplicationDir, deployData); } @@ -128,15 +128,15 @@ public class SessionFactoryImpl implements SessionFactory, LocalSessionLoader { File existingApp = getSessionAppDir(existingSession.getSessionId()); ApplicationId existingApplicationId = existingSession.getApplicationId(); - long liveApp = getLiveApp(existingApplicationId); - logger.log(LogLevel.DEBUG, "Create from existing application id " + existingApplicationId + ", live app for it is " + liveApp); - LocalSession session = create(existingApp, existingApplicationId, liveApp, internalRedeploy, timeoutBudget); + long activeSessionId = getActiveSessionId(existingApplicationId); + logger.log(LogLevel.DEBUG, "Create from existing application id " + existingApplicationId + ", active session id is " + activeSessionId); + LocalSession session = create(existingApp, existingApplicationId, activeSessionId, internalRedeploy, timeoutBudget); session.setApplicationId(existingApplicationId); session.setVespaVersion(existingSession.getVespaVersion()); return session; } - private LocalSession create(File applicationFile, ApplicationId applicationId, long currentlyActiveSession, + private LocalSession create(File applicationFile, ApplicationId applicationId, long currentlyActiveSessionId, boolean internalRedeploy, TimeoutBudget timeoutBudget) { long sessionId = sessionCounter.nextSessionId(); Path sessionIdPath = sessionsPath.append(String.valueOf(sessionId)); @@ -155,7 +155,7 @@ public class SessionFactoryImpl implements SessionFactory, LocalSessionLoader { userApplicationDir, applicationId.application().value(), sessionId, - currentlyActiveSession, + currentlyActiveSessionId, internalRedeploy); applicationPackage.writeMetaData(); return createSessionFromApplication(applicationPackage, sessionId, sessionZooKeeperClient, timeoutBudget, clock); @@ -188,7 +188,7 @@ public class SessionFactoryImpl implements SessionFactory, LocalSessionLoader { return new LocalSession(tenant, sessionId, sessionPreparer, context); } - private long getLiveApp(ApplicationId applicationId) { + private long getActiveSessionId(ApplicationId applicationId) { List<ApplicationId> applicationIds = applicationRepo.listApplications(); if (applicationIds.contains(applicationId)) { return applicationRepo.getSessionIdForApplication(applicationId); diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/zookeeper/SessionCounter.java b/configserver/src/main/java/com/yahoo/vespa/config/server/zookeeper/SessionCounter.java index 2a25553d456..17d0f7e426e 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/zookeeper/SessionCounter.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/zookeeper/SessionCounter.java @@ -25,4 +25,5 @@ public class SessionCounter extends InitializedCounter { public long nextSessionId() { return counter.next(); } + } diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/zookeeper/ZKLiveApp.java b/configserver/src/main/java/com/yahoo/vespa/config/server/zookeeper/ZKLiveApp.java index 8084be1cefa..0aa6a6c88dc 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/zookeeper/ZKLiveApp.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/zookeeper/ZKLiveApp.java @@ -14,7 +14,10 @@ import java.util.logging.Logger; /** * Responsible for providing data from the currently live application subtree in zookeeper. - * (i.e. /vespa/config/apps/<id of currently active app>/) + * (i.e. /vespa/config/apps/<id of currently active app>/). + * + * Note: The application revision ("session") stored in this tree is not necessarily live, just complete, + * preparable, prepared or active. * * @author tonytv */ @@ -34,7 +37,8 @@ public class ZKLiveApp { * Returns a list of the files (as readers) in the given path. The readers <b>must</b> * be closed by the caller. * - * @param path a path relative to the currently active application (i.e. /vespa/config/apps/<id of currently active app>/). + * @param path a path relative to the currently active application + * (i.e. /vespa/config/apps/<id of currently active app>/). * @param fileNameSuffix the suffix of files to return, or null to return all * @param recursive if true, all files from all subdirectories of this will also be returned * @return the files in the given path, or an empty list (never null) if the directory does not exist or is empty. diff --git a/container-search/src/main/java/com/yahoo/prelude/cluster/ClusterSearcher.java b/container-search/src/main/java/com/yahoo/prelude/cluster/ClusterSearcher.java index b1399c6cc8d..0d9534457e9 100644 --- a/container-search/src/main/java/com/yahoo/prelude/cluster/ClusterSearcher.java +++ b/container-search/src/main/java/com/yahoo/prelude/cluster/ClusterSearcher.java @@ -192,8 +192,7 @@ public class ClusterSearcher extends Searcher { private static ClusterParams makeClusterParams(int searchclusterIndex, LegacyEmulationConfig emulConfig, int dispatchIndex) { - return new ClusterParams(searchclusterIndex, - "sc" + searchclusterIndex + ".num" + dispatchIndex, + return new ClusterParams("sc" + searchclusterIndex + ".num" + dispatchIndex, emulConfig); } diff --git a/container-search/src/main/java/com/yahoo/prelude/fastsearch/ClusterParams.java b/container-search/src/main/java/com/yahoo/prelude/fastsearch/ClusterParams.java index f95f303e87c..3dfa506a967 100644 --- a/container-search/src/main/java/com/yahoo/prelude/fastsearch/ClusterParams.java +++ b/container-search/src/main/java/com/yahoo/prelude/fastsearch/ClusterParams.java @@ -11,29 +11,20 @@ import com.yahoo.container.search.LegacyEmulationConfig; */ public class ClusterParams { - public final int clusterNumber; public final String searcherName; public final LegacyEmulationConfig emulation; /** - * For compatibility - */ - public ClusterParams(int number, String name) { - this(number, name, new LegacyEmulationConfig(new LegacyEmulationConfig.Builder())); - } - - /** * For testcases only */ public ClusterParams(String name) { - this(0, name); + this(name, new LegacyEmulationConfig(new LegacyEmulationConfig.Builder())); } /** * Make up full ClusterParams */ - public ClusterParams(int number, String name, LegacyEmulationConfig cfg) { - this.clusterNumber = number; + public ClusterParams(String name, LegacyEmulationConfig cfg) { this.searcherName = name; this.emulation = cfg; } diff --git a/container-search/src/main/java/com/yahoo/prelude/fastsearch/VespaBackEndSearcher.java b/container-search/src/main/java/com/yahoo/prelude/fastsearch/VespaBackEndSearcher.java index 3abd97d814e..34e8390892d 100644 --- a/container-search/src/main/java/com/yahoo/prelude/fastsearch/VespaBackEndSearcher.java +++ b/container-search/src/main/java/com/yahoo/prelude/fastsearch/VespaBackEndSearcher.java @@ -75,9 +75,6 @@ public abstract class VespaBackEndSearcher extends PingableSearcher { /** Cache wrapper */ protected CacheControl cacheControl = null; - /** Searchcluster number */ - private int sourceNumber; - protected final String getName() { return name; } protected final String getDefaultDocsumClass() { return defaultDocsumClass; } @@ -168,7 +165,6 @@ public abstract class VespaBackEndSearcher extends PingableSearcher { public final void init(SummaryParameters docSumParams, ClusterParams clusterParams, CacheParams cacheParams, DocumentdbInfoConfig documentdbInfoConfig) { this.name = clusterParams.searcherName; - this.sourceNumber = clusterParams.clusterNumber; Validator.ensureNotNull("Name of Vespa backend integration", getName()); |