diff options
Diffstat (limited to 'configserver/src/main')
21 files changed, 240 insertions, 103 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/ActivationConflictException.java b/configserver/src/main/java/com/yahoo/vespa/config/server/ActivationConflictException.java new file mode 100644 index 00000000000..48023293cc4 --- /dev/null +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/ActivationConflictException.java @@ -0,0 +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.vespa.config.server; + +/** + * Exception used when activation cannot be done because activation is for + * an older session than the one that is active now or because current active + * session has changed since the session to be activated was created + * + * @author hmusum + */ +public class ActivationConflictException extends RuntimeException { + public ActivationConflictException(String s) { + super(s); + } +} diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationListener.java b/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationListener.java new file mode 100644 index 00000000000..bea25183eef --- /dev/null +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/ApplicationListener.java @@ -0,0 +1,24 @@ +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +package com.yahoo.vespa.config.server; + +import com.yahoo.config.provision.ApplicationId; +import com.yahoo.config.provision.TenantName; +import com.yahoo.vespa.config.server.application.ApplicationSet; + +public interface ApplicationListener { + /** + * Configs has been activated for an application: Either an application + * has been deployed for the first time, or it has been externally or internally redeployed. + * + * Must be thread-safe. + */ + void configActivated(TenantName tenant, ApplicationSet application); + + /** + * Application has been removed. + * + * Must be thread-safe. + */ + void applicationRemoved(ApplicationId applicationId); +} diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/ReloadListener.java b/configserver/src/main/java/com/yahoo/vespa/config/server/ReloadListener.java index 228ae0adfae..e392472480b 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/ReloadListener.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/ReloadListener.java @@ -15,16 +15,7 @@ import java.util.Collection; * @author lulf * @since 5.1 */ -public interface ReloadListener { - - /** - * Signal the listener that config has been reloaded. - * - * @param tenant Name of tenant for which config was reloaded. - * @param application the {@link com.yahoo.vespa.config.server.application.Application} that will be reloaded - */ - public void configReloaded(TenantName tenant, ApplicationSet application); - +public interface ReloadListener extends ApplicationListener { /** * Signal the listener that hosts used by by a particular tenant. * @@ -35,18 +26,10 @@ public interface ReloadListener { /** * Verify that given hosts are available for use by tenant. - * TODO: Does not belong here... * * @param tenant tenant that wants to allocate hosts. * @param newHosts a {@link java.util.Collection} of hosts that tenant wants to allocate. * @throws java.lang.IllegalArgumentException if one or more of the hosts are in use by another tenant. */ void verifyHostsAreAvailable(TenantName tenant, Collection<String> newHosts); - - /** - * Notifies listener that application with id {@link ApplicationId} has been removed. - * - * @param applicationId The {@link ApplicationId} of the removed application. - */ - void applicationRemoved(ApplicationId applicationId); } diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/SuperModelController.java b/configserver/src/main/java/com/yahoo/vespa/config/server/SuperModelController.java index 23c9bab450b..1532c05a56b 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/SuperModelController.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/SuperModelController.java @@ -68,7 +68,7 @@ public class SuperModelController { } } - SuperModel getSuperModel() { + public SuperModel getSuperModel() { return model; } diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/SuperModelListener.java b/configserver/src/main/java/com/yahoo/vespa/config/server/SuperModelListener.java new file mode 100644 index 00000000000..81d706cf2e9 --- /dev/null +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/SuperModelListener.java @@ -0,0 +1,23 @@ +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +package com.yahoo.vespa.config.server; + +import com.yahoo.config.provision.ApplicationId; +import com.yahoo.vespa.config.server.application.Application; +import com.yahoo.vespa.config.server.model.SuperModel; + +/** + * Interface for those wanting to be notified about changes to the SuperModel. + */ +public interface SuperModelListener { + /** + * Application has been activated: Either deployed the first time, + * internally redeployed, or externally triggered redeploy. + */ + void applicationActivated(SuperModel superModel, Application application); + + /** + * Application has been removed. + */ + void applicationRemoved(SuperModel superModel, ApplicationId applicationId); +} diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/SuperModelManager.java b/configserver/src/main/java/com/yahoo/vespa/config/server/SuperModelManager.java new file mode 100644 index 00000000000..c3fd417f434 --- /dev/null +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/SuperModelManager.java @@ -0,0 +1,108 @@ +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +package com.yahoo.vespa.config.server; + +import com.google.inject.Inject; +import com.yahoo.cloud.config.ConfigserverConfig; +import com.yahoo.config.provision.ApplicationId; +import com.yahoo.config.provision.NodeFlavors; +import com.yahoo.config.provision.TenantName; +import com.yahoo.config.provision.Zone; +import com.yahoo.vespa.config.GenerationCounter; +import com.yahoo.vespa.config.server.application.Application; +import com.yahoo.vespa.config.server.application.ApplicationSet; +import com.yahoo.vespa.config.server.model.SuperModel; + +import java.time.Instant; +import java.util.*; + +/** + * Provides a SuperModel - a model of all application instances, and makes it stays + * up to date as applications are added, redeployed, and removed. + */ +public class SuperModelManager implements SuperModelProvider, ApplicationListener { + private final Zone zone; + private SuperModel superModel; // Guarded by 'this' monitor + private final List<SuperModelListener> listeners = new ArrayList<>(); // Guarded by 'this' monitor + + // Generation of the super model + private long generation; + private final long masterGeneration; // ConfigserverConfig's generation + private final GenerationCounter generationCounter; + + @Inject + public SuperModelManager(ConfigserverConfig configserverConfig, + NodeFlavors nodeFlavors, + GenerationCounter generationCounter) { + this.zone = new Zone(configserverConfig, nodeFlavors); + this.generationCounter = generationCounter; + this.masterGeneration = configserverConfig.masterGeneration(); + makeNewSuperModel(new HashMap<>()); + } + + @Override + public synchronized SuperModel getSuperModel() { + return superModel; + } + + @Override + public synchronized long getGeneration() { + return generation; + } + + @Override + public synchronized void registerListener(SuperModelListener listener) { + listeners.add(listener); + } + + @Override + public synchronized void configActivated(TenantName tenant, ApplicationSet applicationSet) { + Map<TenantName, Map<ApplicationId, Application>> newModels = createModelCopy(); + if (!newModels.containsKey(tenant)) { + // New application has been activated + newModels.put(tenant, new LinkedHashMap<>()); + } else { + // Application has been redeployed + } + + // TODO: Should supermodel care about multiple versions? + Application application = applicationSet.getForVersionOrLatest(Optional.empty(), Instant.now()); + newModels.get(tenant).put(applicationSet.getId(), application); + + makeNewSuperModel(newModels); + listeners.stream().forEach(listener -> listener.applicationActivated(superModel, application)); + } + + @Override + public synchronized void applicationRemoved(ApplicationId applicationId) { + Map<TenantName, Map<ApplicationId, Application>> newModels = createModelCopy(); + if (newModels.containsKey(applicationId.tenant())) { + newModels.get(applicationId.tenant()).remove(applicationId); + if (newModels.get(applicationId.tenant()).isEmpty()) { + newModels.remove(applicationId.tenant()); + } + } + + makeNewSuperModel(newModels); + listeners.stream().forEach(listener -> listener.applicationRemoved(superModel, applicationId)); + } + + private void makeNewSuperModel(Map<TenantName, Map<ApplicationId, Application>> newModels) { + generation = masterGeneration + generationCounter.get(); + superModel = new SuperModel(newModels, zone); + } + + private Map<TenantName, Map<ApplicationId, Application>> createModelCopy() { + Map<TenantName, Map<ApplicationId, Application>> currentModels = superModel.applicationModels(); + Map<TenantName, Map<ApplicationId, Application>> newModels = new LinkedHashMap<>(); + for (Map.Entry<TenantName, Map<ApplicationId, Application>> entry : currentModels.entrySet()) { + Map<ApplicationId, Application> appMap = new LinkedHashMap<>(); + newModels.put(entry.getKey(), appMap); + for (Map.Entry<ApplicationId, Application> appEntry : entry.getValue().entrySet()) { + appMap.put(appEntry.getKey(), appEntry.getValue()); + } + } + + return newModels; + } +} diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/SuperModelProvider.java b/configserver/src/main/java/com/yahoo/vespa/config/server/SuperModelProvider.java new file mode 100644 index 00000000000..81eb823c026 --- /dev/null +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/SuperModelProvider.java @@ -0,0 +1,12 @@ +// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +package com.yahoo.vespa.config.server; + +import com.yahoo.vespa.config.server.model.SuperModel; + +interface SuperModelProvider { + SuperModel getSuperModel(); + long getGeneration(); + + void registerListener(SuperModelListener listener); +} 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 105bd9a5b2a..95f16a7c1e7 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 @@ -7,30 +7,26 @@ import com.yahoo.config.ConfigInstance; import com.yahoo.config.model.api.ConfigDefinitionRepo; import com.yahoo.config.provision.NodeFlavors; import com.yahoo.config.provision.Version; -import com.yahoo.config.provision.Zone; import com.yahoo.log.LogLevel; import com.yahoo.vespa.config.ConfigKey; +import com.yahoo.vespa.config.GenerationCounter; import com.yahoo.vespa.config.GetConfigRequest; import com.yahoo.vespa.config.protocol.ConfigResponse; import com.yahoo.vespa.config.server.application.Application; import com.yahoo.config.provision.ApplicationId; import com.yahoo.config.provision.TenantName; -import com.yahoo.vespa.config.GenerationCounter; import com.yahoo.vespa.config.server.application.ApplicationSet; -import com.yahoo.vespa.config.server.model.SuperModel; import com.yahoo.vespa.config.server.rpc.ConfigResponseFactory; import com.yahoo.vespa.config.server.rpc.ConfigResponseFactoryFactory; import java.io.IOException; -import java.time.Instant; -import java.util.Collections; import java.util.LinkedHashMap; import java.util.Map; import java.util.Optional; import java.util.Set; /** - * Handles request for supermodel config + * Handles request for supermodel config. * * @author lulf * @since 5.9 @@ -39,91 +35,59 @@ public class SuperModelRequestHandler implements RequestHandler { private static final java.util.logging.Logger log = java.util.logging.Logger.getLogger(SuperModelRequestHandler.class.getName()); private volatile SuperModelController handler; - private final GenerationCounter generationCounter; - private final Zone zone; - private final long masterGeneration; private final ConfigDefinitionRepo configDefinitionRepo; private final ConfigResponseFactory responseFactory; + private final SuperModelManager superModelManager; private volatile boolean enabled = false; /** * Creates a supermodel controller */ @Inject - public SuperModelRequestHandler(GenerationCounter generationCounter, ConfigDefinitionRepo configDefinitionRepo, - ConfigserverConfig configserverConfig, NodeFlavors nodeFlavors) { - this.generationCounter = generationCounter; + public SuperModelRequestHandler(ConfigDefinitionRepo configDefinitionRepo, + ConfigserverConfig configserverConfig, + SuperModelManager superModelManager) { this.configDefinitionRepo = configDefinitionRepo; - this.masterGeneration = configserverConfig.masterGeneration(); this.responseFactory = ConfigResponseFactoryFactory.createFactory(configserverConfig); - this.zone = new Zone(configserverConfig, nodeFlavors); - this.handler = createNewHandler(Collections.emptyMap()); + this.superModelManager = superModelManager; + updateHandler(); } /** * Signals that config has been reloaded for an {@link com.yahoo.vespa.config.server.application.Application} * belonging to a tenant. * - * TODO: This is a bit too complex I think. - * * @param tenant Name of tenant owning the application. * @param applicationSet The reloaded set of {@link com.yahoo.vespa.config.server.application.Application}. */ public synchronized void reloadConfig(TenantName tenant, ApplicationSet applicationSet) { - Map<TenantName, Map<ApplicationId, Application>> newModels = createModelCopy(); - if (!newModels.containsKey(tenant)) { - newModels.put(tenant, new LinkedHashMap<>()); - } - // TODO: Should supermodel care about multiple versions? - newModels.get(tenant).put(applicationSet.getId(), applicationSet.getForVersionOrLatest(Optional.empty(), Instant.now())); - handler = createNewHandler(newModels); + superModelManager.configActivated(tenant, applicationSet); + updateHandler(); } public synchronized void removeApplication(ApplicationId applicationId) { - Map<TenantName, Map<ApplicationId, Application>> newModels = createModelCopy(); - if (newModels.containsKey(applicationId.tenant())) { - newModels.get(applicationId.tenant()).remove(applicationId); - if (newModels.get(applicationId.tenant()).isEmpty()) { - newModels.remove(applicationId.tenant()); - } - } - handler = createNewHandler(newModels); - } - - private SuperModelController createNewHandler(Map<TenantName, Map<ApplicationId, Application>> newModels) { - long generation = generationCounter.get() + masterGeneration; - SuperModel model = new SuperModel(newModels, zone); - return new SuperModelController(model, configDefinitionRepo, generation, responseFactory); - } - - private Map<TenantName, Map<ApplicationId, Application>> getCurrentModels() { - if (handler != null) { - return handler.getSuperModel().applicationModels(); - } else { - return new LinkedHashMap<>(); - } + superModelManager.applicationRemoved(applicationId); + updateHandler(); } - private Map<TenantName, Map<ApplicationId, Application>> createModelCopy() { - Map<TenantName, Map<ApplicationId, Application>> currentModels = getCurrentModels(); - Map<TenantName, Map<ApplicationId, Application>> newModels = new LinkedHashMap<>(); - for (Map.Entry<TenantName, Map<ApplicationId, Application>> entry : currentModels.entrySet()) { - Map<ApplicationId, Application> appMap = new LinkedHashMap<>(); - newModels.put(entry.getKey(), appMap); - for (Map.Entry<ApplicationId, Application> appEntry : entry.getValue().entrySet()) { - appMap.put(appEntry.getKey(), appEntry.getValue()); - } - } - return newModels; + private void updateHandler() { + handler = new SuperModelController( + superModelManager.getSuperModel(), + configDefinitionRepo, + superModelManager.getGeneration(), + responseFactory); } public SuperModelController getHandler() { return handler; } @Override public ConfigResponse resolveConfig(ApplicationId appId, GetConfigRequest req, Optional<Version> vespaVersion) { - log.log(LogLevel.DEBUG, "SuperModelRequestHandler resolving " + req + " for app id '" + appId + "'"); + log.log(LogLevel.DEBUG, () -> "SuperModelRequestHandler resolving " + req + " for app id '" + appId + "'"); if (handler != null) { - return handler.resolveConfig(req); + ConfigResponse configResponse = handler.resolveConfig(req); + log.log(LogLevel.DEBUG, () -> "SuperModelRequestHandler returning response for config " + req + + " with generation " + configResponse.getGeneration()); + return configResponse; } return null; } diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/deploy/Deployment.java b/configserver/src/main/java/com/yahoo/vespa/config/server/deploy/Deployment.java index 51995eb98cf..e38be55290f 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/deploy/Deployment.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/deploy/Deployment.java @@ -9,6 +9,7 @@ import com.yahoo.log.LogLevel; import com.yahoo.path.Path; import com.yahoo.transaction.NestedTransaction; import com.yahoo.transaction.Transaction; +import com.yahoo.vespa.config.server.ActivationConflictException; import com.yahoo.vespa.config.server.tenant.ActivateLock; import com.yahoo.vespa.config.server.ApplicationRepository; import com.yahoo.vespa.config.server.TimeoutBudget; @@ -29,7 +30,7 @@ import java.util.logging.Logger; * Deployments are created by a {@link ApplicationRepository}. * Instances of this are not multithread safe. * - * @author lulf + * @author Ulf Lilleengen * @author bratseth */ public class Deployment implements com.yahoo.config.provision.Deployment { @@ -128,7 +129,7 @@ public class Deployment implements com.yahoo.config.provision.Deployment { log.log(LogLevel.DEBUG, "Trying to acquire lock " + activateLock + " for session " + sessionId); boolean acquired = activateLock.acquire(timeoutBudget, ignoreLockFailure); if ( ! acquired) { - log.log(LogLevel.DEBUG, "Acquiring " + activateLock + " for session " + sessionId + " returned false"); + throw new InternalServerException("Did not get activate lock for session " + sessionId + " within " + timeout); } log.log(LogLevel.DEBUG, "Lock acquired " + activateLock + " for session " + sessionId); @@ -202,25 +203,25 @@ public class Deployment implements com.yahoo.config.provision.Deployment { ", current active session=" + currentActiveSessionSessionId); if (currentActiveSession.isNewerThan(activeSessionAtCreate) && currentActiveSessionSessionId != sessionId) { - String errMsg = currentActiveSession.logPre()+"Cannot activate session " + + String errMsg = currentActiveSession.logPre() + "Cannot activate session " + sessionId + " because the currently active session (" + currentActiveSessionSessionId + ") has changed since session " + sessionId + " was created (was " + activeSessionAtCreate + " at creation time)"; if (ignoreStaleSessionFailure) { log.warning(errMsg + " (Continuing because of force.)"); } else { - throw new IllegalStateException(errMsg); + throw new ActivationConflictException(errMsg); } } } - // As of now, config generation is based on session id, and config generation must be an monotonically + // As of now, config generation is based on session id, and config generation must be a monotonically // increasing number private void checkIfActiveIsNewerThanSessionToBeActivated(long sessionId, long currentActiveSessionId) { if (sessionId < currentActiveSessionId) { - throw new IllegalArgumentException("It is not possible to activate session " + sessionId + - ", because it is older than current active session (" + - currentActiveSessionId + ")"); + throw new ActivationConflictException("It is not possible to activate session " + sessionId + + ", because it is older than current active session (" + + currentActiveSessionId + ")"); } } diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/http/HttpConfigRequest.java b/configserver/src/main/java/com/yahoo/vespa/config/server/http/HttpConfigRequest.java index 3fc7f43e4af..6ba788aced3 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/http/HttpConfigRequest.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/http/HttpConfigRequest.java @@ -27,10 +27,10 @@ import com.yahoo.vespa.config.util.ConfigUtils; /** * A request to get config, bound to tenant and app id. Used by both v1 and v2 of the config REST API. * - * @author lulf - * @since 5.1 + * @author Ulf Lilleengen */ public class HttpConfigRequest implements GetConfigRequest, TenantRequest { + private static final String HTTP_PROPERTY_NOCACHE = "noCache"; private final ConfigKey<?> key; private final ApplicationId appId; diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/http/HttpErrorResponse.java b/configserver/src/main/java/com/yahoo/vespa/config/server/http/HttpErrorResponse.java index 7e0c57f2e5f..81806a0afe7 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/http/HttpErrorResponse.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/http/HttpErrorResponse.java @@ -35,6 +35,7 @@ public class HttpErrorResponse extends HttpResponse { public enum errorCodes { APPLICATION_LOCK_FAILURE, BAD_REQUEST, + ACTIVATION_CONFLICT, INTERNAL_SERVER_ERROR, INVALID_APPLICATION_PACKAGE, METHOD_NOT_ALLOWED, @@ -64,6 +65,10 @@ public class HttpErrorResponse extends HttpResponse { return new HttpErrorResponse(BAD_REQUEST, errorCodes.BAD_REQUEST.name(), msg); } + public static HttpErrorResponse conflictWhenActivating(String msg) { + return new HttpErrorResponse(CONFLICT, errorCodes.ACTIVATION_CONFLICT.name(), msg); + } + public static HttpErrorResponse methodNotAllowed(String msg) { return new HttpErrorResponse(METHOD_NOT_ALLOWED, errorCodes.METHOD_NOT_ALLOWED.name(), msg); } diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/http/HttpHandler.java b/configserver/src/main/java/com/yahoo/vespa/config/server/http/HttpHandler.java index 53bfbf5135f..c13d1b3fcfa 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/http/HttpHandler.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/http/HttpHandler.java @@ -8,6 +8,7 @@ import com.yahoo.container.jdisc.LoggingRequestHandler; import com.yahoo.container.logging.AccessLog; import com.yahoo.log.LogLevel; import com.yahoo.config.provision.OutOfCapacityException; +import com.yahoo.vespa.config.server.ActivationConflictException; import com.yahoo.yolean.Exceptions; import java.io.PrintWriter; @@ -47,6 +48,8 @@ public class HttpHandler extends LoggingRequestHandler { } } catch (NotFoundException | com.yahoo.vespa.config.server.NotFoundException e) { return HttpErrorResponse.notFoundError(getMessage(e, request)); + } catch (ActivationConflictException e) { + return HttpErrorResponse.conflictWhenActivating(getMessage(e, request)); } catch (BadRequestException | IllegalArgumentException | IllegalStateException e) { return HttpErrorResponse.badRequest(getMessage(e, request)); } catch (OutOfCapacityException e) { diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/model/SuperModel.java b/configserver/src/main/java/com/yahoo/vespa/config/server/model/SuperModel.java index 1d7bcd8d001..eb41373aab8 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/model/SuperModel.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/model/SuperModel.java @@ -13,6 +13,7 @@ import com.yahoo.vespa.config.ConfigPayload; import com.yahoo.vespa.config.server.application.Application; import java.util.Collections; +import java.util.LinkedHashMap; import java.util.Map; /** @@ -26,7 +27,7 @@ public class SuperModel implements LbServicesConfig.Producer, RoutingConfig.Prod private final Map<TenantName, Map<ApplicationId, Application>> models; private final LbServicesProducer lbProd; private final RoutingProducer zoneProd; - + public SuperModel(Map<TenantName, Map<ApplicationId, Application>> models, Zone zone) { this.models = models; this.lbProd = new LbServicesProducer(Collections.unmodifiableMap(models), zone); diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/modelfactory/ModelsBuilder.java b/configserver/src/main/java/com/yahoo/vespa/config/server/modelfactory/ModelsBuilder.java index 6a4ab40d843..6bd21e9cfb6 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/modelfactory/ModelsBuilder.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/modelfactory/ModelsBuilder.java @@ -112,11 +112,11 @@ public abstract class ModelsBuilder<MODELRESULT extends ModelResult> { Version latest = findLatest(versions); // load latest application version MODELRESULT latestModelVersion = buildModelVersion(modelFactoryRegistry.getFactory(latest), - applicationPackage, - applicationId, - wantedNodeVespaVersion, - allocatedHosts.asOptional(), - now); + applicationPackage, + applicationId, + wantedNodeVespaVersion, + allocatedHosts.asOptional(), + now); allocatedHosts.set(latestModelVersion.getModel().allocatedHosts()); // Update with additional clusters allocated if (latestModelVersion.getModel().skipOldConfigModels(now)) 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 37f8aa4ea40..5a1352de17d 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 @@ -112,7 +112,7 @@ class GetConfigProcessor implements Runnable { } catch (UnknownConfigIdException e) { handleError(request, ErrorCode.ILLEGAL_CONFIGID, "Illegal config id " + request.getConfigKey().getConfigId()); return; - } catch (Exception e) { + } catch (Throwable e) { log.log(Level.SEVERE, "Unexpected error handling config request", e); handleError(request, ErrorCode.INTERNAL_ERROR, "Internal error " + e.getMessage()); return; diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/rpc/RpcServer.java b/configserver/src/main/java/com/yahoo/vespa/config/server/rpc/RpcServer.java index 1a2433ec77e..4fe78a30344 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/rpc/RpcServer.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/rpc/RpcServer.java @@ -187,7 +187,7 @@ public class RpcServer implements Runnable, ReloadListener, TenantListener { * This method should be called when config is reloaded in the server. */ @Override - public void configReloaded(TenantName tenant, ApplicationSet applicationSet) { + public void configActivated(TenantName tenant, ApplicationSet applicationSet) { ApplicationId applicationId = applicationSet.getId(); configReloaded(delayedConfigResponses.drainQueue(applicationId), Tenants.logPre(applicationId)); reloadSuperModel(tenant, applicationSet); diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/session/PrepareParams.java b/configserver/src/main/java/com/yahoo/vespa/config/server/session/PrepareParams.java index d70ed584c3d..cbcfb865acf 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/session/PrepareParams.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/session/PrepareParams.java @@ -18,8 +18,7 @@ import java.util.Set; /** * Parameters for prepare. Immutable. * - * @author lulf - * @since 5.1.24 + * @author Ulf Lilleengen */ public final class PrepareParams { diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionZooKeeperClient.java b/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionZooKeeperClient.java index 09fc83e225d..8f056898374 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionZooKeeperClient.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionZooKeeperClient.java @@ -172,7 +172,7 @@ public class SessionZooKeeperClient { } public Version readVespaVersion() { - if ( ! configCurator.exists(versionPath())) return Vtag.currentVersion; + if ( ! configCurator.exists(versionPath())) return Vtag.currentVersion; // TODO: This should not be possible any more - verify and remove return new Version(configCurator.getData(versionPath())); } diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/tenant/TenantRequestHandler.java b/configserver/src/main/java/com/yahoo/vespa/config/server/tenant/TenantRequestHandler.java index 20d1e88440f..93c26d532bb 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/tenant/TenantRequestHandler.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/tenant/TenantRequestHandler.java @@ -2,7 +2,6 @@ package com.yahoo.vespa.config.server.tenant; import java.time.Clock; -import java.time.Instant; import java.util.*; import com.yahoo.config.provision.Version; @@ -81,7 +80,7 @@ public class TenantRequestHandler implements RequestHandler, ReloadHandler, Host private void notifyReloadListeners(ApplicationSet applicationSet) { for (ReloadListener reloadListener : reloadListeners) { reloadListener.hostsUpdated(tenant, hostRegistry.getAllHosts()); - reloadListener.configReloaded(tenant, applicationSet); + reloadListener.configActivated(tenant, applicationSet); } } diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/zookeeper/ConfigCurator.java b/configserver/src/main/java/com/yahoo/vespa/config/server/zookeeper/ConfigCurator.java index c09fe5ae4bb..c7a79556397 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/zookeeper/ConfigCurator.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/zookeeper/ConfigCurator.java @@ -35,9 +35,8 @@ import java.util.concurrent.atomic.AtomicInteger; * Some methods have retries and/or reconnect. This is necessary because ZK will throw on certain scenarios, * even though it will recover from it itself, @see http://wiki.apache.org/hadoop/ZooKeeper/ErrorHandling * - * @author vegardh + * @author Vegard Havdal * @author bratseth - * @since 5.0 */ public class ConfigCurator { diff --git a/configserver/src/main/resources/configserver-app/services.xml b/configserver/src/main/resources/configserver-app/services.xml index 730f9cb3136..9330dae2e41 100644 --- a/configserver/src/main/resources/configserver-app/services.xml +++ b/configserver/src/main/resources/configserver-app/services.xml @@ -15,6 +15,7 @@ <component id="com.yahoo.vespa.config.server.session.FileDistributionFactory" bundle="configserver" /> <component id="com.yahoo.vespa.config.server.modelfactory.ModelFactoryRegistry" bundle="configserver" /> <component id="com.yahoo.vespa.config.server.SuperModelGenerationCounter" bundle="configserver" /> + <component id="com.yahoo.vespa.config.server.SuperModelManager" bundle="configserver" /> <component id="com.yahoo.vespa.config.server.session.SessionPreparer" bundle="configserver" /> <component id="com.yahoo.vespa.config.server.SuperModelRequestHandler" bundle="configserver" /> <component id="com.yahoo.vespa.config.server.StaticConfigDefinitionRepo" bundle="configserver" /> |