aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorten Tokle <mortent@verizonmedia.com>2021-12-06 08:11:55 +0100
committerGitHub <noreply@github.com>2021-12-06 08:11:55 +0100
commit73dc82a5149bfdefaba22e85eea09855a6a77965 (patch)
treeacaa9876cdb78e48aca4531353db32ac210235d7
parentfa63f735ff37b87842e41155fca702da24e5d88e (diff)
parent055be6477315abceafc54be690b88f48784f7256 (diff)
Merge pull request #20355 from vespa-engine/mpolden/log-status-changev7.511.3
Log change of routing status and deploy
-rw-r--r--configserver/src/main/java/com/yahoo/vespa/config/server/http/v1/RoutingStatusApiHandler.java10
-rw-r--r--configserver/src/test/java/com/yahoo/vespa/config/server/http/v1/RoutingStatusApiHandlerTest.java16
2 files changed, 22 insertions, 4 deletions
diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/http/v1/RoutingStatusApiHandler.java b/configserver/src/main/java/com/yahoo/vespa/config/server/http/v1/RoutingStatusApiHandler.java
index 957868f2abb..0dc7dbda9a1 100644
--- a/configserver/src/main/java/com/yahoo/vespa/config/server/http/v1/RoutingStatusApiHandler.java
+++ b/configserver/src/main/java/com/yahoo/vespa/config/server/http/v1/RoutingStatusApiHandler.java
@@ -4,6 +4,7 @@ package com.yahoo.vespa.config.server.http.v1;
import com.google.inject.Inject;
import com.yahoo.config.provision.ApplicationId;
import com.yahoo.config.provision.Deployer;
+import com.yahoo.config.provision.Deployment;
import com.yahoo.jdisc.http.HttpRequest;
import com.yahoo.path.Path;
import com.yahoo.restapi.RestApi;
@@ -117,11 +118,14 @@ public class RoutingStatusApiHandler extends RestApiRequestHandler<RoutingStatus
// Redeploy application so that a new LbServicesConfig containing the updated status is generated and consumed
// by routing layer. This is required to update weights for application endpoints when routing status for a
// deployment is changed
+ log.log(Level.INFO, "Changing routing status of " + instance + " from " +
+ currentStatus.status() + " to " + wantedStatus.status());
changeStatus(upstreamNames, wantedStatus);
try {
- deployer.deployFromLocalActive(instance, Duration.ofMinutes(1));
+ Optional<Deployment> deployment = deployer.deployFromLocalActive(instance, Duration.ofMinutes(1));
+ if (deployment.isEmpty()) throw new IllegalArgumentException("No deployment of " + instance + " found");
+ deployment.get().activate();
} catch (Exception e) {
-
log.log(Level.SEVERE, "Failed to redeploy " + instance + ". Reverting routing status to " +
currentStatus.status(), e);
changeStatus(upstreamNames, currentStatus);
@@ -138,6 +142,8 @@ public class RoutingStatusApiHandler extends RestApiRequestHandler<RoutingStatus
/** Change routing status of a zone */
private SlimeJsonResponse changeZoneStatus(RestApi.RequestContext context) {
boolean in = context.request().getMethod() == HttpRequest.Method.DELETE;
+ log.log(Level.INFO, "Changing routing status of zone from " + zoneStatus() + " to " +
+ (in ? RoutingStatus.in : RoutingStatus.out));
if (in) {
curator.delete(ZONE_STATUS);
return new SlimeJsonResponse(toSlime(RoutingStatus.in));
diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v1/RoutingStatusApiHandlerTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v1/RoutingStatusApiHandlerTest.java
index d16030767d5..8dd7cf4d6fc 100644
--- a/configserver/src/test/java/com/yahoo/vespa/config/server/http/v1/RoutingStatusApiHandlerTest.java
+++ b/configserver/src/test/java/com/yahoo/vespa/config/server/http/v1/RoutingStatusApiHandlerTest.java
@@ -4,6 +4,7 @@ package com.yahoo.vespa.config.server.http.v1;
import com.yahoo.config.provision.ApplicationId;
import com.yahoo.config.provision.Deployer;
import com.yahoo.config.provision.Deployment;
+import com.yahoo.config.provision.HostFilter;
import com.yahoo.container.jdisc.HttpRequestBuilder;
import com.yahoo.container.jdisc.HttpResponse;
import com.yahoo.jdisc.http.HttpRequest.Method;
@@ -197,8 +198,19 @@ public class RoutingStatusApiHandlerTest {
if (failNextDeployment) {
throw new RuntimeException("Deployment failed");
}
- lastDeployed.put(application, clock.instant());
- return Optional.empty();
+ return Optional.of(new Deployment() {
+ @Override
+ public void prepare() {}
+
+ @Override
+ public long activate() {
+ lastDeployed.put(application, clock.instant());
+ return 1L;
+ }
+
+ @Override
+ public void restart(HostFilter filter) {}
+ });
}
@Override